﻿<UserControl x:Class="FR.SAFTAnalyser.Views.GeneralLedgerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <DockPanel>

        <DockPanel.Resources>
            <CollectionViewSource x:Key="generalLedger" Source="{Binding GeneralLedger, IsAsync=True}"/>
        </DockPanel.Resources>

        <toolkit:WatermarkTextBox 
            DockPanel.Dock="Top" Margin="3" TabIndex="2"
            Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged}"
            Watermark="Filtro por: Nº conta ou Descrição ou Débito abertura ou Crédito abertura"/>

        <Button DockPanel.Dock="Bottom" Width="100" Height="25" Margin="5" Padding="3" HorizontalAlignment="Right" ToolTip="Exportar para Excel"
                Command="{Binding DoPrintCommand}"
                CommandParameter="{Binding ElementName=dataGridGeneralLedger}">
            <StackPanel Orientation="Horizontal">
                <Image Source="{StaticResource Excel}"/>
                <TextBlock Text="Contas" Padding="5,0,0,0"/>
            </StackPanel>
        </Button>

        <DataGrid x:Name="dataGridGeneralLedger" DockPanel.Dock="Bottom" VerticalAlignment="Stretch" TabIndex="1"
                  ItemsSource="{Binding Source={StaticResource generalLedger}}">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Nº conta" Binding="{Binding AccountID}" />
                <DataGridTextColumn Header="Descrição" Binding="{Binding AccountDescription}" />
                <DataGridTextColumn Header="Débito abertura" Binding="{Binding OpeningDebitBalance}" />
                <DataGridTextColumn Header="Crédito abertura" Binding="{Binding OpeningCreditBalance}" />
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</UserControl>
